/* RMORPG - Server.h
   Copyright (C) 2007  Michael Borgmann <code@lechuck.de>
   This code is released under the GNU Public License (GPL)
 */

#ifndef _SERVER_H
#define _SERVER_H

#include <vector>
#include "Socket.h"

namespace rmorpg {

	/**
	 * Server Class
	 */
	class Server {
		private:
			Socket listener;
			int incoming;

			int activity;

			std::vector<int>connection;
			std::vector<int>::iterator socket;

			fd_set sockets;

			char buffer[128];
			int bytes;

			int i;
			bool done;

			struct timeval timeout;

			struct sockaddr_in socketaddress;
			socklen_t sa_size; //  = sizeof(sockaddr_in);

			/**
			 * Listening Server
			 */
			bool Listening();

			/**
			 * Multiplexing Server
			 */
			bool Multiplexing();

		public:
			/**
			 * Default Constructor
			 */
			Server();

			/**
			 * Default Destructor
			 */
			virtual ~Server();

	};
}

#endif // end _SERVER_H
